﻿using System;

namespace Microsoft.WowAddonStudio.FrameXml.Services
{
    public class FrameXmlResourceService : IDisposable
    {
        protected bool disposed;

        /// <summary>
        /// Initializes a new instance of the <see cref="FrameXmlResourceService"/> class.
        /// </summary>
        /// <param name="resourceFileLoader">The resource file loader.</param>
        public FrameXmlResourceService(ResourceFileLoader resourceFileLoader)
        {
            if (resourceFileLoader == null)
                throw new ArgumentNullException("resourceFileLoader");

            ResourceFileLoader = resourceFileLoader;
        }

        /// <summary>
        /// Gets the <see cref="ResourceFileLoader"/>.
        /// </summary>
        protected ResourceFileLoader ResourceFileLoader { get; private set; }

        /// <summary>
        /// Performs application-defined tasks associated with freeing,
        /// releasing, or resetting unmanaged resources.
        /// </summary>
        public void Dispose()
        {
            Dispose(true);
			GC.SuppressFinalize(this);
        }

		/// <summary>
		/// Releases unmanaged and - optionally - managed resources
		/// </summary>
		/// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
		protected virtual void Dispose(bool disposing)
		{
			disposed = true;
		}
    }
}
